using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.ComponentModel;

namespace PSE.Framework.Common.Exceptions.FaultContracts
{ 
    /// <summary>
    /// Business Fault returned by the WCF Services when occurs any business exception.
    /// </summary>
    [DataContract(Namespace = "http://www.bvmf.com.br/PSE.Framework.Common.Exceptions.FaultContracts", Name = "BusinessFault")]
    public class BusinessFault
    {
        #region Fields
        private string _errorMessage;   // The error message to be returned.
        private int _errorNumber;

        #endregion

        #region Constructors

        /// <summary>
        /// Default Constructor.
        /// </summary>
        public BusinessFault()
        {
        }

        /// <summary>
        /// Constructor that receives error message associated to this Fault.
        /// </summary>
        /// <param name="errorMessage">The error message.</param>
        public BusinessFault(string errorMessage)
        {
            _errorMessage = errorMessage;
        }

        #endregion

        #region Public Members

        /// <summary>
        /// Error Message. Defined as a DataMember.
        /// </summary>
        [DataMember(IsRequired = true, Name = "ErrorMessage", Order = 2)]
        public string ErrorMessage
        {
            get { return _errorMessage; }
            set { _errorMessage = value; }
        }

        /// <summary>
        /// Error Number. Defined as a DataMember.
        /// </summary>
        [DataMember(IsRequired = true, Name = "ErrorNumber", Order = 1)]
        public int ErrorNumber
        {
            get { return _errorNumber; }
            set { _errorNumber = value; }
        }

       #endregion
    }
}
